class Feed::MoneyIntroduceToJoin < Feed
  
  validates_presence_of :added_money
  validates_presence_of :user_id,
    :money
    
  def before_create
    self.version = 1
    self.added_money = 10
    self.money = user.money + 10
  end
  
  def after_create
    user.money += added_money
    user.save(false)
  end
  
  # to template
  def to_t
    ":user介绍:introducedor于:created_at_ago_in_words前加入了麦吐司, 获得了:added_money麦粒的:bounty_of_introduce_to_join"
  end
end